<?php
$page_title="Manage Members - List";
include("includes/header.php");

?>
<style>
.section_panel div{
float:left;	
text-align:center;
padding:2px;
}
.section_panel a{
padding-top:14px;
}

</style>

<div class="fleft">
<ul class="subMenu">
<li><a href="edit_member.php?mode=add" >Add New Member</a>
<? if(checkRole(SUPER_ADMIN) ) { ?>
	<li><a     href="javascript:exportMember()">Export to Excel</a></li>
	<li><a   href="javascript:notifyMember()">Send Login Info</a></li>
	<li style="width:170px"><a   href="javascript:requestResume(2)">Request Resume for Selected</a></li>
	<li style="width:150px"><a   href="javascript:requestResume(-1)">Request Resume for All</a></li>
	
<? } ?>
<li><a   href="javascript:viewDuplicates()">View Duplicates</a></li>
<li><a    href="javascript:sendMail()">Editable Request Mail</a></li>

</ul>
 
</div>

<div class="cleardiv"></div>
<?



	$reg_countries = qry_data("select distinct ltrim(rtrim(reg_country)) as reg_country from bkitc_profiles where rec_status=1 order by reg_country asc");
	$custom_country=Array();
	while(list($key,$value)=each($reg_countries)){
		$custom_country[$value["reg_country"]]=$value["reg_country"];
		
	}
	$reg_countries=$countries + $custom_country;

		
	$reg_countries[""]="----All Countries----";

	$reg_states = qry_data("select distinct ltrim(rtrim(reg_state)) as reg_state from bkitc_profiles where rec_status=1 order by reg_state asc");

	$custom_state=Array();
	while(list($key,$value)=each($reg_states)){
		$custom_state[$value["reg_state"]]=$value["reg_state"];
	}
	$reg_states=$states + $custom_state;
	
	$reg_states[""]="----All States----";


	$reg_cities = qry_data("select distinct ltrim(rtrim(reg_city)) as   reg_city from bkitc_profiles where rec_status=1 order by reg_city asc");
	
	$custom_city=Array();
	$custom_city[""]="";
	while(list($key,$value)=each($reg_cities)){
		$custom_city[$value["reg_city"]]=$value["reg_city"];
	}
	$reg_cities=$custom_city;
	
			
	$reg_cities[""]="----All Cities----";
?>
<div class="bodyContent">
<form method="post" action="registrants.php" name="frmsearch" id="frmsearch">						


				<table celpadding="0" cellspacing="0" width="100%"  class="section_panel">

					<tr>
						<td >
							&nbsp;Search by Keyword : <input  title="keyword contains  in Name, Email, Address, Educational Qualification, Technical Qualification" type="text" name="txtSearch" size="14"  value="<?php echo $_REQUEST["txtSearch"]; ?>" class="txtbox" id="txtSearch"/> <input class="button" type="submit" value="Go"/>
							&nbsp;&nbsp;Filter by :
							<select id="ddlfilter" class="selectbox" name="ddlfilter" onchange="frmsearch.submit()">
								<option value="-1">---ALL---</option>
								<option value="1">Recently Registered</option>
								<option value="28" class="label_bg_alert">Registered for Seva</option>
								<option value="20">Registrant ID in Ascending Order</option>
								<option value="21">Registrant ID in Descending Order</option>
								<option value="22">Technical Qualification</option>
								<option value="26" class="label_bg_alert">With Resumes</option>
								<option value="27" class="label_bg_alert">Without Resumes</option>
								
								<option value="23">Currently Working</option>
								<option value="24">Duplicate Name</option>
								<option value="25">Duplicate Email Id</option>

								<option value="2" class="label_bg_alert">Archived Members</option>
								<!--<option value="3">Reg via Site</option>
								<option value="4">Reg via Admin</option>-->
								<option value="5" >BK Members</option>
								<option value="6">Non-BK Members</option>
								<option value="7">BK - < 5Y in Gyan</option>
								<option value="8">BK - > 5Y in Gyan</option>
								<option value="9">Members - Brothers</option>
								<option value="10">Members - Sisters</option>
								<option value="11" >Working Members</option>
								<option value="12">With Experience</option>
								<option value="13">With Email Address</option>
								<option value="14" class="label_bg_alert">Without Email Address</option>
								<option value="15">With Phone.No</option>
								<option value="16" class="label_bg_alert">Without Phone.No</option>
								<option value="17">Professional Body</option>
								<option value="18">With Photos</option>
								<option value="19" >Without Photos</option>

							</select>&nbsp;&nbsp;
							<span class="label_12" id="srchmsg"></span>
						</td>
						<td class="label_12 pointer"   onclick="$('rptDate').toggle()"  >
							<input type="hidden" name="rptAdvRptMode" value="0" />  
							&nbsp;<span class="bold label_grey">Advanced Filter </span>  <img src="images/combobox_arrow.png" align="absmiddle"  onclick="$('rptDate').toggle()" >
							
						</td>
					</tr>
					
				</table>

		



<div id="rptDate" class="section_panelnew" style="display:none">
	
	<div style="width:200px;float:left;" class="searchform">
	
		<b class="label_11">By Date : <select id="dtFilter" name="dtFilter" class="selectbox"><option value="1">Registration Date</option><option value="2">Loukik DOB </option><option value="3">Aloukik DOB</option></select></b>
		<br/>
		between
		<br/>
		<script type="text/javascript">DateInput('from_dt', true, 'YYYY-MM-DD','2009-02-01')</script>
		
		and
		<script type="text/javascript">DateInput('to_dt', true, 'YYYY-MM-DD')</script>
		<b class="label_10">Sub Filter</b><br/>
		<ul type="none">
		<li><input type="checkbox" id="chkFilter1" name="chkchkFilter[]" value="1"/><label for="chkFilter1">BKs</label></li>
		<li><input type="checkbox" id="chkFilter2" name="chkchkFilter[]" value="2"/><label for="chkFilter2">Non-BKs</label></li>
		<li><input type="checkbox" id="chkFilter3" name="chkchkFilter[]" value="3" /><label for="chkFilter3">New registrations</label></li>
		<li><input type="checkbox" id="chkFilter4" name="chkchkFilter[]" value="4"/><label for="chkFilter4">Updated registrations</label></li>
		
		
		</ul>
		
		
		<input class="button" type="button" value="Go" onclick="showAdvReport(1)" />
	
	</div>
	<div style="width:300px;float:left;display:none;" class="searchform">
		
		<b class="label_11">By Special Interest Group</b> <br/>
		
		<div><input type="checkbox" value="-2"  onclick="chkAllGroups(this.checked)" /> All Groups </div>
		<input type="hidden" name="sigOption" value="0" />  
		<div><input type="checkbox" value="1" class="sig" />PMO<br/></div>
		<div><input type="checkbox" value="2" class="sig"/>IT Infrastructure</div>
		<div><input type="checkbox" value="3"  class="sig"/>Project Collaboration tools</div>
		<div><input type="checkbox" value="4" class="sig"/>Helpdesk</div>
		<div><input type="checkbox" value="5" class="sig"/>Website Frontend</div>
		<div><input type="checkbox" value="6" class="sig"/>App dev & web scripts</div>
		<div><input type="checkbox" value="7" class="sig"/>Multimedia</div>
		<div><input type="checkbox" value="8" class="sig"/>IT industry service</div>
		<div><input type="checkbox" value="9" class="sig"/>Information Research</div>
		<input class="button" type="button" value="Go" onclick="showAdvReport(2)" />
		<input class="button" type="button" value="Show Group Not Assigned" onclick="showAdvReport(11)" />
		<div class="cleardiv"></div> 
	</div>

	<div style="float:none;">

	
		<b class="label_11">By Geographical Location  : <br/>  </b><br/>
		
		City <br/><?=createSelect("reg_city", $reg_cities,  $selected = $_POST["reg_city"])?><br/>
		State <br/><?=createSelect("reg_state", $reg_states,  $selected = $_POST["reg_state"])?><br/>
		Country <br/><?=createSelect("reg_country", $reg_countries,  $selected = $_POST["reg_country"])?><br/>
		
		
		Company Address  <br/><input type="text" name="company_address" value="<?=$_POST["company_address"]?>" size="40" class="txtbox"/><br/>
		BK Centre Address  <br/><input type="text" name="bk_center_address" value="<?=$_POST["bk_center_address"]?>" size="40" class="txtbox"/><br/>
		
		BK Centre Email Address <br/><input type="text" name="bk_center_email" value="<?=$_POST["bk_center_email"]?>" size="40" class="txtbox"/>
		<input class="button" type="button" value="Go" onclick="showAdvReport(3)" /><br>
		
	</div>

	<div style="float:right;margin-bottom:10px;"><input class="button" type="button" value="Search By All Sections" onclick="showAdvReport(20)" /></div><br/>
	<div class="cleardiv"></div> 
	
</div>
<div class="cleardiv"></div> 

<?php
$ddlFilterVal=$_POST["ddlfilter"];
$advFilterMode=$_POST["rptAdvRptMode"];
if($_REQUEST["txtSearch"]!="") $ddlFilterVal="-1";
if($_REQUEST["seva"]!="") $ddlFilterVal="28";

if($ddlFilterVal=="") $ddlFilterVal="21";
if($_POST["txtSearch"]!="" && $ddlFilterVal>0) 
{
	//$_POST["txtSearch"]="";
}




$query = "SELECT * FROM bkitc_profiles where rec_status=1 and dob!='0000-00-00' and year(dob)>=1920";
$where="";



if($advFilterMode==1 || $advFilterMode==20) 
{

$frDate=$_POST["from_dt"];
$toDate=$_POST["to_dt"];


$subFilters=$_REQUEST["chkchkFilter"];

if(count($subFilters)>0){
if(in_array(1,$subFilters)){
$where.=" and are_you_bk=1";
}
if(in_array(2,$subFilters)){
$where.=" and are_you_bk=0";

}

if(in_array(3,$subFilters)){

if($_REQUEST["dtFilter"]==1)
	$where.=" and  date(submission_date) between date('$frDate' )  and date('$toDate') ";
	

	
}

if(in_array(4,$subFilters)){
$where.=" and  date(last_updated) between date('$frDate' )  and date('$toDate') ";
}

}else{
	
	
	if($_REQUEST["dtFilter"]==1)
	$where.=" and  date(submission_date) between date('$frDate' )  and date('$toDate') ";
	
if($_REQUEST["dtFilter"]==2)
	$where.=" and  date(dob) between date('$frDate' )  and date('$toDate') ";
	
if($_REQUEST["dtFilter"]==3)
	$where.=" and  date(aloukik_dob) between date('$frDate' )  and date('$toDate') ";

}
//$where.=" and  date(submission_date) between date('$frDate' )  and date('$toDate') ";
}

if($advFilterMode==2 || $advFilterMode==20 && $_POST["sigOption"]!="") $where.=" and  registrant_id in (select distinct  member_id from bkitc_member_sig where sig_id in (".$_POST["sigOption"].")) ";
if($advFilterMode==2  && $_POST["sigOption"]=="-1") $where=" and  registrant_id not in (select distinct member_id from bkitc_member_sig) ";

if($advFilterMode==3 || $advFilterMode==20)
{
$where.=" and  reg_city like '%#1%' and reg_state like '%#2%' and reg_country like '%#4%' and bk_center_address like  '%#5%' and  company_address like '%#6%' and  company_address like '%#7%'";

$where=str_replace("#1",$_POST["reg_city"]==""?"%":$_POST["reg_city"],$where);
$where=str_replace("#2",$_POST["reg_state"]==""?"%":$_POST["reg_state"],$where);
$where=str_replace("#4",$_POST["reg_country"]==""?"%":$_POST["reg_country"],$where);
$where=str_replace("#5",$_POST["bk_center_address"]==""?"%":$_POST["bk_center_address"],$where);
$where=str_replace("#6",$_POST["company_address"]==""?"%":$_POST["company_address"],$where);
$where=str_replace("#7",$_POST["bk_center_email"]==""?"%":$_POST["bk_center_email"],$where);

}

if($advFilterMode>0) $ddlFilterVal="-1";
if($ddlFilterVal!="")
{

	switch($ddlFilterVal)
	{

	case 1 :
			$where=" and  (To_days(date(curdate())) - TO_DAYS(date(submission_date))<=7)";
			break;
	case 2 :
			//$where=" and  rec_status=0";
			$query=str_replace("rec_status=1","rec_status=0",$query);
			break;

	case 3 :
			$where=" and reg_type=1";
			break;
	case 4 :
			$where=" and reg_type=2";
			break;
	case 5 :
			$where=" and are_you_bk=1";
			break;
	case 6 :
			$where=" and are_you_bk=0";
			break;
	case 7 :
			$where=" and ((To_days( curdate()) - TO_DAYS( aloukik_dob )) *365  <=1825 ) and are_you_bk=1";
			break;
	case 8 :
			$where=" and ((To_days( curdate()) - TO_DAYS( aloukik_dob )) *365  >1825 ) and are_you_bk=1";
			break;
	case 9 :
			$where=" and gender=1";
			break;
	case 10 :
			$where=" and gender=2";
			break;
	case 11 :
			$where=" and company_address!=''";
			break;
	case 12 :
			$where=" and years_it_exp!=''";
			break;
	case 13 :
			$where=" and (email_id!='')";
			break;
	case 14 :
			$where=" and (email_id='')";
			break;
	case 15 :
			$where=" and (telephone_no!='' or mobile_no!='')";
			break;
	case 16 :
			$where=" and (telephone_no='' or mobile_no='')";
			break;
		
	case 17 :
			$where=" and are_you_prof='1'";
			break;
	case 18 :
			$where=" and photo_filename!=''";
			break;
	case 19 :
			$where=" and photo_filename=''";
			break;
	case 20 :
			$orderby=" order by registrant_id asc";
			break;
	case 21 :
			$orderby=" order by  registrant_id desc";
			break;
	case 22 :
			$orderby=" order by technical_specifications asc";
			break;
	case 23 :
			$orderby=" order by  company_address desc";
			break;
	case 24 :
			$where=" and full_name in (SELECT full_name  FROM bkitc_profiles where full_name!='' and  rec_status=1 group by full_name having count(*) >1) ";
			$orderby=" order by  full_name asc";
			break;

	case 25 :
			$where=" and email_id in (SELECT email_id  FROM bkitc_profiles where   rec_status=1 group by email_id having count(*) >1) ";
			$orderby=" order by  email_id asc";
			break;
			
	case 26 :
			$where=" and resume_filename!=''";
			$orderby=" order by  resume_uploaded desc";
			break;
	case 27 :
			$where=" and resume_filename=''";
			break;
	case 28 :
	$where=" and reg_seva=1";
	break;
	break;

	default:
	break;

	}

}
if($_REQUEST["txtSearch"]!="")
{
$keyword=$_REQUEST["txtSearch"];
$where .=" and (full_name like ".enclose("%".$keyword."%")." or reg_technical_remark like ".enclose("%".$keyword."%")." or technical_specifications like ".enclose("%".$keyword."%")." or edu_qual like ".enclose("%".$keyword."%")." or contact_address like ".enclose("%".$keyword."%")." or mobile_no like ".enclose("%".$keyword."%")." or seva_sig_list like ".enclose("%".$keyword."%")." or contact_address like ".enclose("%".$keyword."%")." or email_id like  ".enclose("%".$keyword."%").")";
}
$query .=$where;



$per_page=(int)$_REQUEST["txtrcount"];
if($per_page==0) $per_page=50;
$cur_page=(int)$_REQUEST["page"];
if($cur_page==0) $cur_page=1;
$end=$per_page;

$start=($per_page * ($cur_page-1)) ;

if($_REQUEST["mode"]=="result"){
	$memberInfo = qry_data($_SESSION['member_query']." limit ".$start.", ".$end);
	$_POST=$_SESSION['POST_DATA'];
	$ddlFilterVal="";
	
$info1=qry_data(str_replace(" * "," Count(*) as total ",$_SESSION['member_query']));
$total_rec=(int)$info1[0]["total"];
	
}else{

$info1=qry_data(str_replace(" * "," Count(*) as total ",$query));

$total_rec=(int)$info1[0]["total"];

	if($ddlFilterVal>=20 && $ddlFilterVal<=28)
		$memberInfo = qry_data($query." ".$orderby." limit ".$start.", ".$end);
	else
		$memberInfo = qry_data($query." order by full_name"." limit ".$start.", ".$end);
		
		

}

$_SESSION['member_query']=$query." order by full_name"; 
$_SESSION['POST_DATA']=$_POST;
?>
<table   width="100%" class="table_panel" cellspacing="0" cellpadding="4">
<tr>
<? if(checkRole(SUPER_ADMIN) ) { ?>
<th  width="5"><input type="checkbox"  class="chk_all"   onclick="var chkState=this.checked;$$('.chk_item').each(function(vItem){vItem.checked=chkState;});"/></th>
<? } ?>
<th width="1">SNo</th>
<th width="5">Reg.Id</th>
<th>Name</th>
<th width="1">M/F</th>
<th>Email</th>
<th>Skype Id</th>
<th>Mobile</th>
<th>Is BK?</th>
<th>Last CV Upload on</th>
<th >Last Updated by Member On</th>
<th>View/Edit/Delete</th>
</tr>
<? foreach($memberInfo as $i=>$member) {?>
<?
$date_diff=dateDifference(time(),$member["aloukik_dob"]);

$years=$date_diff["years"];
$months=$date_diff["months"];
$yearsInfo=$years. "yr ".$months. "mth";
if($member["aloukik_dob"]=="0000-00-00") $yearsInfo="Yes";
?>
<?$nofile=0;
 if(!file_exists("../images/photos/".$member["registrant_id"]."/".$member["photo_filename"])) $nofile=1;
if($member["photo_filename"]=="") $nofile=1;
 ?>

<tr <?if($i%2==0) echo 'class="white_bg"'; else echo 'class="grey_bg"' ?> >
<? if(checkRole(SUPER_ADMIN) ) { ?>
<td><input type="checkbox" class="chk_item" value="<?=$member["registrant_id"]?>"/></td>
<? } ?>
<td><?=$i+1;?></td>
<td><a href="site_log.php?memberid=<?=$member["registrant_id"]?>"><?=formatMemberCode($member["registrant_id"]);?></a></td>
<td><?=$member["full_name"];?></td>
<td><?if($member["gender"]=="1") echo "M"; else echo "F";?></td>
<td><?=$member["email_id"];?></td>
<td><?=$member["reg_chat_id"];?></td>
<td><?=$member["mobile_no"];?></td>

<td><?if($member["are_you_bk"]=="1") echo "".$yearsInfo; else echo "No";?>

</td>
<td><?=$member["resume_uploaded"]?></td>
<!--<td><?if($nofile==1) echo "No"; else echo "Yes";?></td>-->
<td><?=$member["last_updated"]?></td>

<td>
<a  href="javascript:"  onclick="window.open('view_member.php?mode=edit&mid=<?=$member["registrant_id"];?>','Info','width=600;height=400;toolbars=0;')">View</a> | 
<a href="edit_member.php?mode=edit&mid=<?=$member["registrant_id"];?>">Edit</a> 

<? if(checkRole(SUPER_ADMIN) ||  checkRole(ADMIN) ) { ?>
| 
<? if($ddlFilterVal==2) { ?>
	<a  href="javascript:if(confirm('Are you sure to make this member active from archived?')) location.href='edit_member.php?mode=active&mid=<?=$member["registrant_id"];?>'";>Activate</a> 	
<? }else { ?>
	<a  href="javascript:if(confirm('Are you sure to delete this member?')) location.href='edit_member.php?mode=del&mid=<?=$member["registrant_id"];?>'";>Delete</a> 
<? }?>
<? } ?>
</td>
</tr>

<? } ?>
</table>

<div class="section_panel">
<table width="100%">
<tr>
<td width="100">Records Per Page</td>
<td ><input type="text" name="txtrcount" value="<?=$per_page?>" class="txtbox" size="1" onblur="$('frmsearch').submit();"/>
&nbsp;&nbsp;&nbsp;
Add Selected to Invitation List
<?$invlist_info=qry_data("select * from bkitc_invite_list where rec_status=1");?>
<select class="selectbox" id="selInvList" name="selInvList" >
<option value="0">---Select Invitation List---</option>
<?foreach($invlist_info as $i=>$prg){?>
<option value="<?=$prg["list_id"]?>"><?=$prg["list_title"]?></option>
<? } ?>

</select>
<input type="button" value="Go" class="button" onclick="addToInvList()"
/> <!--Invite Members for Internal Program : 
<select class="selectbox" id="selPrg" name="selPrg" onchange="inviteMember(this.value)">
<option value="0">---Select Program---</option>
<?foreach($prgInfo as $i=>$prg){?>
<option value="<?=$prg["prg_id"]?>"><?=$prg["prg_title"]?></option>
<? } ?>

</select>

 : <a href="prg_list.php">View Program List</a>-->
</td>
<td align="right" >
<div style="float:right">

<?=generatePager($per_page,$total_rec,$cur_page)?>
</div>
</td>
</tr>
</table>
</div>
</form>
</div>

<script language="javascript">
var frmsearch=$('frmsearch');
<?

if($ddlFilterVal!="" || 2>1)
{
?>

document.getElementById("ddlfilter").value='<?=$ddlFilterVal?>';
document.getElementById("srchmsg").innerHTML='<?=$total_rec?> Member(s) found.';

<?
}
?>
function chkAllGroups(vCurState){
strList="";
$$(".sig").each(function(vItem){
		vItem.checked=vCurState;
		}
		);

}

function showAdvReport(vMode)
{
strList="";
if(vMode==2 || vMode==20)
{
$$(".sig").each(function(vItem){
		if(vItem.checked){
		 if(strList=="")
			 strList=vItem.value
		 else 
			strList=strList + "," + vItem.value ;
		 }}
		);

frmsearch.sigOption.value=strList;


}
if(vMode==11)
{
frmsearch.sigOption.value="-1";

}

frmsearch.rptAdvRptMode.value=vMode;
frmsearch.submit();

}


function requestResume(vMode){


var strList="";

$$(".chk_item").each(function(vItem){
		if(vItem.checked){
		 if(strList=="")
			 strList=vItem.value
		 else 
			strList=strList + "," + vItem.value ;
		 }}
		);

if(strList!="" && vMode==2){

if(confirm("Are you sure to request members to upload resume?. If yes, please click ok.")){

new Ajax.Request("notify_member.php?mv="+vMode+"&sel="+strList, {
				method: 'get',
				onSuccess: function(req) {
					alert(req.responseText);
					//onSuccess(req);
				}
			});
			
}
}else{


if(vMode==-1){

if(confirm("Are you sure to send request to all the members to upload resume who have not done yet?")){

new Ajax.Request("notify_member.php?mv="+vMode+"&sel="+strList, {
				method: 'get',
				onSuccess: function(req) {
					alert(req.responseText);
					//onSuccess(req);
				}
			});
			
}
}else{


alert("Please select the members by clicking the checkboxes to send resume upload request to members");
}
}


}

function addToInvList(){
var strList="";
$$(".chk_item").each(function(vItem){
		if(vItem.checked){
		 if(strList=="")
			 strList=vItem.value
		 else 
			strList=strList + "," + vItem.value ;
		 }}
		);

var listId=$("selInvList").value;

if(confirm("Do you want to add the selected members to the invitation list")){

	new Ajax.Request("handler.php?hmode=1&sel="+strList+"&list_id=" + listId, {
			method: 'get',
			onSuccess: function(req) {
				alert(req.responseText);
				//onSuccess(req);
			}
		});
		
	}



}

function exportMember(){


var strList="";

$$(".chk_item").each(function(vItem){
		if(vItem.checked){
		 if(strList=="")
			 strList=vItem.value
		 else 
			strList=strList + "," + vItem.value ;
		 }}
		);


location.href="export.php?mlist=" + strList;

}

function notifyMember(){

var strList="";

$$(".chk_item").each(function(vItem){
		if(vItem.checked){
		 if(strList=="")
			 strList=vItem.value
		 else 
			strList=strList + "," + vItem.value ;
		 }}
		);

if(strList!=""){
if(confirm("Are you sure to notify login information to selected members?. If yes, please click ok.")){
new Ajax.Request("notify_member.php?sel="+strList, {
				method: 'get',
				onSuccess: function(req) {
					alert(req.responseText);
					//onSuccess(req);
				}
			});
}
}else{

alert("Please select the members by clicking the checkboxes to send login info to members");
}


}

function showPage(vHref){
$("frmsearch").action=vHref;
$("frmsearch").submit();

}

function sendMail(){
var strList="";
$$(".chk_item").each(function(vItem){
		if(vItem.checked){
		 if(strList=="")
			 strList=vItem.value
		 else 
			strList=strList + "," + vItem.value ;
		 }}
		);
		

if(strList!="") 
{

location.href="send_email.php?sel=" + strList;

}
else{

alert("Please select the member before sending editable email");

}




}
function inviteMember(vPrgId){
var strList="";
$$(".chk_item").each(function(vItem){
		if(vItem.checked){
		 if(strList=="")
			 strList=vItem.value
		 else 
			strList=strList + "," + vItem.value ;
		 }}
		);
		

if(strList==""){

alert("Please select atleat 1 member for inviting to the program.");
$('selPrg').value=0;
return;
}	
if(vPrgId==0) return;	
if(confirm('Are you sure to invite selected members to this program?')){
	

new Ajax.Request("notify_member.php?prg_id=" +vPrgId+ "&mv=1&sel="+strList, {
				method: 'get',
				onSuccess: function(req) {
					alert(req.responseText);
					//onSuccess(req);
				}
			});

}

}

function viewDuplicates(){

location.href="member_report.php?mode=d";
//window.open("member_report.php?mode=d","","width=300,height=300,scrollbars=0,menubars=0,toolbars=0");

}
</script>

<?php
include("includes/footer.php");
?>
<!--<div style="display:none"><?=$_SESSION['member_query']?></div>-->
<?


function generatePager($perpage,$total_rec,$curpage){



$totalpages=ceil($total_rec/$perpage);

$pageHtml="";
if($curpage>1) $pageHtml.="<div><a href='registrants.php?page=".($curpage-1)."' onclick='showPage(this.href);return false;'>Prev</a></div>";
$pageHtml.="<div><select class='selectbox' onchange=\"showPage('registrants.php?page=' + this.value)\">";


for($j=1;$j<=$totalpages;$j++){

$selstat="selected";
if($curpage!=$j) $selstat="";
$pageHtml.="<option ".$selstat.">".$j."</option>";
}

$pageHtml.="</select></div>";
if($curpage<$totalpages) $pageHtml.="<div><a href='registrants.php?page=".($curpage+1)."' onclick='showPage(this.href);return false;'>Next</a></div>";

return $pageHtml;


}


?>